package com.yjtc.cbg.mytoolbardemo;

import android.app.Activity;
import android.graphics.Outline;
import android.graphics.Path;
import android.graphics.Rect;
import android.os.Bundle;
import android.view.View;
import android.view.ViewOutlineProvider;
import android.widget.ImageView;
import android.widget.TextView;

/**
 * Created by chenboge on 16/6/1.
 */
public class TestActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.test);
        TextView textView = (TextView) findViewById(R.id.textView);
        TextView textView2 = (TextView) findViewById(R.id.textView1);

        ViewOutlineProvider mProvider = null;
        mProvider = new ViewOutlineProvider() {
            @Override
            public void getOutline(View view, Outline outline) {
                view.setClipToOutline(true);
                outline.setOval(60, 60, view.getWidth(), view.getHeight());
            }
        };

        ViewOutlineProvider mProvider1 = null;
        mProvider1 = new ViewOutlineProvider() {
            @Override
            public void getOutline(View view, Outline outline) {
                view.setClipToOutline(true);
                outline.setOval(new Rect(60, 60, view.getWidth()-20, view.getHeight()-20));
                outline.setAlpha((float)0.1);
            }
        };
        textView.setOutlineProvider(mProvider);
        textView2.setOutlineProvider(mProvider1);


    }
}
